-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Unit test connecting UVC host to UVC device #93666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
5eb38f5
to
e754e06
Compare
The way this works:
The UVC class implementation can now start, before the USB Host class API is present. |
e524c88
to
692cd97
Compare
baf895e
to
b319828
Compare
Thank you for your answer @MarkWangChinese.
If I understand correctly, you would be working on an USB Audio Class (such as UAC2) support? It seems like we have a skeleton of functions in zephyr/include/zephyr/usb/usbh.h Lines 75 to 97 in 5c7c398
This current PR is turned into an unit test.
Thank you for the update! I will do my best to adapt my local version to what you built, so feel free to go ahead implementing things differently. |
b9fa4dd
to
1a68f6d
Compare
Yes, we are working on the usb host video class and usb host stack with NXP platforms, and connect with actual usb camera. |
771738e
to
cf4ed33
Compare
Please retry analysis of this Pull-Request directly on SonarQube Cloud |
Add a "struct usbh_status" that contains a bitmask of flags to keep track of the global state of the host context, like done for the device_next implementation. Signed-off-by: Josuah Demangeon <[email protected]>
Add a "struct usbh_class_api" for the host implementation, and move all the function poitners to it. Add more fields to "struct usbh_class_data". Signed-off-by: Josuah Demangeon <[email protected]>
Add API wrappers around the function pointers in struct usbh_class_api, while also documenting the USB host class internal API. Signed-off-by: Josuah Demangeon <[email protected]>
Add functions to probe/remove all classes as part of a new usbh_class.c and a matching usbh_class.h. These functions are called from the function usbh_init_device_intl() in usbh_core.c to initialize every class upon connection of a device. The class instances are registered and connected together as a linked list. Co-authored-by: Aiden Hu <[email protected]> Signed-off-by: Josuah Demangeon <[email protected]>
Add utilities to filter a class and search the next descriptor of a given type. This can be used to in combination to seek device information from the USB descriptors and try to match a host class instance given a set of filters. Co-authored-by: Aiden Hu <[email protected]> Signed-off-by: Josuah Demangeon <[email protected]>
Move the UVC header with all the definitions from the UVC standard to share it between USB host and device class implementation. Signed-off-by: Josuah Demangeon <[email protected]>
Add tests making sure the USB Host class APIs introduced build and run as expected. Signed-off-by: Josuah Demangeon <[email protected]>
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
Allocate extra room at the end of the USB descriptor buffer to ensure that the device ends with `desc->bLength == 0`. For now, validating `desc->bLength` from the device to ensure no access past the buffer is still not done. Signed-off-by: Josuah Demangeon <[email protected]>
Move the UVC header with all the definitions from the UVC standard to share it between USB host and device class implementation. Signed-off-by: Josuah Demangeon <[email protected]>
When USB device is not defined, there is no macro for the maximum number of dwFrameInterval[] defined, so default to 1 instead of CONFIG_USBD_VIDEO_MAX_FRMIVAL. Signed-off-by: Josuah Demangeon <[email protected]>
Move UVC helper functions to a file shared between UVC host and device. The arrays are not visible anymore from either USB host or device, but instead accessed through a front-end funciton. Signed-off-by: Josuah Demangeon <[email protected]>
cf4ed33
to
377298b
Compare
Loop through each of the VideoStreaming and VideoControl descriptor to parse them. Signed-off-by: Josuah Demangeon <[email protected]>
Add a test to run the USB Video Class host support by using the existing Zephyr USB Video Class device support. This allows running implementing the host side from the device side. A draft implementation of UVC is added leveraging this test. Signed-off-by: Josuah Demangeon <[email protected]>
377298b
to
e4d4cf9
Compare
|
This is a draft implementation not meant to be merged, but as a work bench and support for discussion around #93517.
It uses UVB and the virtual USB device and host back-ends to experiment with the USB APIs.
This permit to run the device class and host class without requiring USB hardware.
To build and run on native sim:
output